#!/usr/bin/perl

if ( $#ARGV < 0 ) {
  print "usage: analyze_tcpdump.pl <directory>\n"; 
  exit; 
}

$dir = $ARGV[0]; 

my( @files ) = < $dir/* > ; 

foreach $file (@files) { 
   print "file=$file\n";
 
   if ( ($file eq "." ) || ( $file eq ".." ) ) { 
      next ; 
   } 
   if ( -d $file ) { 
      $conf = $file . "/ping.conf"; 
      if ( -r $conf ) { 
         $output = $file . "/analysis_tcpdump.txt"; 
         print "analyze tcpdump file under $file, save output to $output\n"; 
         system ("./analyze_tcpdump.pl $file > $output"); 
      }
   }
}

